package com.example.barcodeapp.ui.home.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.appcompat.widget.Toolbar;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.RoundedCorners;
import com.bumptech.glide.request.RequestOptions;
import com.example.barcodeapp.R;
import com.example.barcodeapp.base.BaseActivity;
import com.example.barcodeapp.common.Constants;
import com.example.barcodeapp.interfaces.own.IOwn;
import com.example.barcodeapp.persenter.OnePresenterJiaoShiXiangQing;
import com.example.barcodeapp.ui.home.JiaoShiXiangQingAdapter;
import com.example.barcodeapp.ui.home.bean.JiaoShiXiangQingBean;
import com.example.barcodeapp.utils.SystemUtils;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class JiaoShiXiangQingJieMianActivity extends BaseActivity<IOwn.Persenterjiaoshixiangqing> implements IOwn.Viewjiaoshixiangqing {
    @BindView(R.id.iv_back_circle)
    ImageView ivBackCircle;
    @BindView(R.id.ff_back_contener)
    FrameLayout ffBackContener;
    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_location)
    TextView tvLocation;
    @BindView(R.id.tv_title)
    TextView tvTitle;
    @BindView(R.id.ll_to_search)
    LinearLayout llToSearch;
    @BindView(R.id.right_iv)
    ImageView rightIv;
    @BindView(R.id.right_iv_two)
    ImageView rightIvTwo;
    @BindView(R.id.tv_rught_)
    TextView tvRught;
    @BindView(R.id.tv_right_two)
    TextView tvRightTwo;
    @BindView(R.id.toolBar)
    Toolbar toolBar;
    @BindView(R.id.linearLayout8)
    LinearLayout linearLayout8;
    @BindView(R.id.imageView17)
    ImageView imageView17;
    @BindView(R.id.textView47)
    TextView textView47;
    @BindView(R.id.jiaoshi_xiaojianjie)
    TextView jiaoshiXiaojianjie;
    @BindView(R.id.jiaoshi_guanhzu)
    TextView jiaoshiGuanhzu;
    @BindView(R.id.constraintLayout5)
    ConstraintLayout constraintLayout5;
    @BindView(R.id.linearLayout6)
    LinearLayout linearLayout6;
    @BindView(R.id.linearLayout7)
    LinearLayout linearLayout7;
    @BindView(R.id.jiaoshiyueke)
    TextView jiaoshiyueke;
    @BindView(R.id.constraintLayout6)
    ConstraintLayout constraintLayout6;
    @BindView(R.id.textView49)
    TextView textView49;
    @BindView(R.id.zhiboke)
    RecyclerView zhiboke;
    @BindView(R.id.constraintLayout7)
    ConstraintLayout constraintLayout7;
    @BindView(R.id.textView50)
    TextView textView50;
    @BindView(R.id.gongkaike)
    RecyclerView gongkaike;
    @BindView(R.id.constraintLayout8)
    ConstraintLayout constraintLayout8;
    @BindView(R.id.textView51)
    TextView textView51;
    @BindView(R.id.xileike)
    RecyclerView xileike;
    @BindView(R.id.neirongwa)
    TextView neirongwa;
    @BindView(R.id.biaoqian1)
    TextView biaoqian1;
    @BindView(R.id.biaoqian2)
    TextView biaoqian2;
    @BindView(R.id.biaoqian3)
    TextView biaoqian3;

    @Override
    protected int getLayout() {
        return R.layout.jiaoshijieshao_activity;
    }

    @Override
    protected void initView() {
        setToolBar(true, false, true, false, false);
        setTitle("教师详情", R.color.black, R.color.white);
        jiaoshiyueke.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent instant = new Intent(JiaoShiXiangQingJieMianActivity.this, RiLiYueKeJiaoShiLeiBiaoActivituy.class);
                startActivity(instant);
            }
        });
    }

    @Override
    protected OnePresenterJiaoShiXiangQing initPersenter() {
        return new OnePresenterJiaoShiXiangQing();
    }

    @Override
    protected void initData() {
        Intent intent = getIntent();
        int data = intent.getIntExtra("data",2);
        String neirong = intent.getStringExtra("neirong");
        if (neirong.equals("状态")){
            persenter.getjiaoshineirong(data,2);
        }else {
            persenter.getjiaoshineirong(Constants.jiasohilanmuid,2);
        }


    }

    @Override
    public void getjiaoxiangqing(JiaoShiXiangQingBean xiLieKeBean) {

        //头像圆角
        int round = SystemUtils.px2Dp(this, 100);
        RoundedCorners roundedCorners = new RoundedCorners(round);
        RequestOptions options = RequestOptions.bitmapTransform(roundedCorners);
        Glide.with(this).load(Constants.Base_TPUrl2 + xiLieKeBean.getData().getImage()).apply(options).into(imageView17);
        textView47.setText(xiLieKeBean.getData().getName());
        jiaoshiXiaojianjie.setText(xiLieKeBean.getData().getTouxian());
        neirongwa.setText(xiLieKeBean.getData().getJianjie());
        biaoqian1.setText(xiLieKeBean.getData().getCoursecate());
        biaoqian2.setVisibility(View.INVISIBLE);
        biaoqian3.setVisibility(View.INVISIBLE);
        JiaoShiXiangQingAdapter jiaoShiXiangQingAdapter = new JiaoShiXiangQingAdapter(this, xiLieKeBean.getData().getKechen());
        xileike.setLayoutManager(new LinearLayoutManager(this));
        xileike.setAdapter(jiaoShiXiangQingAdapter);
        jiaoShiXiangQingAdapter.notifyDataSetChanged();


    }



}
